import React from 'react'
import MenuCommon from './menuCommon'


export default class MenuPerfect extends React.Component{

    state = {
        rcMenuLoaded : false,
    }

    componentWillMount(){
        loadjs.isDefined("rc-menu") ? loadjs.ready('rc-menu',()=>{
            this.setState({rcMenuLoaded:true})
        }) : loadjs(['/cloudstore/resource/pc/rc-menu/rc-menu.js','/cloudstore/resource/pc/rc-menu/rc-menu.css'],'rc-menu',()=>{
            this.setState({rcMenuLoaded:true})
        })
    }

    render(){
        const {rcMenuLoaded} = this.state
        let contextComponent = null
        if(rcMenuLoaded){
            contextComponent = <MenuCommon ecId={`${this && this.props && this.props.ecId || ''}_MenuCommon@2ijzh7`} {...this.props}></MenuCommon>
        }
        return contextComponent
    }
}